import React, { Component } from 'react'
import axios from 'axios'

export default class App extends Component {
  getStudentDatas= () =>{
    axios.get('http://localhost:3000/api1/students').then(
      response =>{console.log('get成功',response.data);},
      error =>{console.log('get失败',error);}
    )
  }
  getCarDatas=()=>{
    axios.get('http://localhost:3000/api2/cars').then(
      response =>{console.log('get成功',response.data);},
      error =>{console.log('get失败',error);}
    )
  }
  render() {
    return (
      <div>
        <button onClick={this.getStudentDatas}> 点我get学生数据  </button>    
        <button onClick={this.getCarDatas}> 点我get汽车数据  </button>  
      </div>
    )
  }
}

